summaryrefslogtreecommitdiffstats
path: root/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/SettingsViewModel.kt
blob: a0cb7225f19f3a1d637f7c25382ff39bebd450c2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

package org.yuzu.yuzu_emu.model

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

class SettingsViewModel : ViewModel() {
    var game: Game? = null

    var shouldSave = false

    private val _toolbarTitle = MutableLiveData("")
    val toolbarTitle: LiveData<String> get() = _toolbarTitle

    private val _shouldRecreate = MutableLiveData(false)
    val shouldRecreate: LiveData<Boolean> get() = _shouldRecreate

    private val _shouldNavigateBack = MutableLiveData(false)
    val shouldNavigateBack: LiveData<Boolean> get() = _shouldNavigateBack

    private val _shouldShowResetSettingsDialog = MutableLiveData(false)
    val shouldShowResetSettingsDialog: LiveData<Boolean> get() = _shouldShowResetSettingsDialog

    private val _shouldReloadSettingsList = MutableLiveData(false)
    val shouldReloadSettingsList: LiveData<Boolean> get() = _shouldReloadSettingsList

    private val _isUsingSearch = MutableLiveData(false)
    val isUsingSearch: LiveData<Boolean> get() = _isUsingSearch

    fun setToolbarTitle(value: String) {
        _toolbarTitle.value = value
    }

    fun setShouldRecreate(value: Boolean) {
        _shouldRecreate.value = value
    }

    fun setShouldNavigateBack(value: Boolean) {
        _shouldNavigateBack.value = value
    }

    fun setShouldShowResetSettingsDialog(value: Boolean) {
        _shouldShowResetSettingsDialog.value = value
    }

    fun setShouldReloadSettingsList(value: Boolean) {
        _shouldReloadSettingsList.value = value
    }

    fun setIsUsingSearch(value: Boolean) {
        _isUsingSearch.value = value
    }

    fun clear() {
        game = null
        shouldSave = false
    }
}